package com.hotelsystem.service.impl;

import com.hotelsystem.dao.StatusMapper;
import com.hotelsystem.pojo.Status;
import com.hotelsystem.service.StatusService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service(value = "statusServiceImpl")
public class StatusServiceImpl implements StatusService {

//    @Resource
//    private RedisTemplate<Object,Object> redisTemplate;

    @Resource
    private StatusMapper statusMapper;

    //查询出所有的状态
    @Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
    @Override
    public List<Status> getAllStatus() {

//        Object getAllStatus = redisTemplate.opsForValue().get("getAllStatusLists");
//        if (getAllStatus==null){
        List<Status>  getAllStatus = statusMapper.getAllStatus();
//            redisTemplate.opsForValue().set("getAllStatusLists",getAllStatus);

//        }
        return getAllStatus;
    }
}
